<?php 
require_once("Response.php");
$response = new Response();
$link = create_connection();

class Admin
{
	public $id;
	public $usernm;
	public $nickname;
	public $phone;
	public $last_login_time;
}

$sql="select * from admin";
$result=@execute_sql($link,'zhihu',$sql);
if($result) {
	$data = array();//初始化数组;
    while ($row = mysqli_fetch_assoc($result)) {
		$alter = new Admin();//实例化对象;
		$alter->id = $row['id'];
		$alter->usernm = $row['usernm'];
		$alter->nickname = $row['nickname'];
		$alter->phone = $row['phone'];
		$alter->last_login_time = $row['last_login_time'];
		$data[] = $alter;
	}
	$response->code = 200;
	$response->message = "success";
	$response->data = $data;
	echo json_encode($response);
} else {
	$response->code = 404;
	$response->message = "error";
	echo json_encode($response);
}

?>